﻿<%@ Page Language="C#" MasterPageFile="~/MangerPage.master" AutoEventWireup="true" CodeFile="Manger_Majors.aspx.cs" Inherits="Manger_Majors" Title="专业管理" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="pagetitle">专业管理</div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="mytable"
        DataKeyNames="Major_ID" DataSourceID="SqlDataSource1" OnRowCommand="GridView1_RowCommand" OnRowDeleted="GridView1_RowDeleted">
        <Columns>
            <asp:BoundField DataField="Major_ID" HeaderText="专业代码" ReadOnly="True" SortExpression="Major_ID" />
            <asp:BoundField DataField="Major_Name" HeaderText="专业名称" SortExpression="Major_Name" />
            <asp:TemplateField>
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Update">确定</asp:LinkButton>
                    &nbsp;
                    <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Cancel">取消</asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit">编辑</asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete" OnClientClick="return confirm('确定删除此专业？')">删除</asp:LinkButton>
                    <asp:LinkButton ID="LinkButton5" runat="server" CommandName="Insert">新增</asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="Major_ID"
                DataSourceID="SqlDataSource1" DefaultMode="Insert" Height="50px" OnItemInserted="DetailsView1_ItemInserted"
                Width="300px">
                <Fields>
                    <asp:BoundField DataField="Major_ID" HeaderText="专业代码:" ReadOnly="True" SortExpression="Major_ID" />
                    <asp:BoundField DataField="Major_Name" HeaderText="专业名称:" SortExpression="Major_Name" />
                    <asp:ButtonField CommandName="Insert" Text="新增专业" />
                </Fields>
                <FieldHeaderStyle CssClass="table_fieldheader" />
                <InsertRowStyle CssClass="table_fielddata" />
            </asp:DetailsView>
        </EmptyDataTemplate>
    </asp:GridView>
    &nbsp;<br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Jxzy_Database %>"
        DeleteCommand="DELETE FROM [zyk_Majors] WHERE [Major_ID] = @Major_ID" InsertCommand="INSERT INTO [zyk_Majors] ([Major_ID], [Major_Name]) VALUES (@Major_ID, @Major_Name)"
        SelectCommand="SELECT [Major_ID], [Major_Name] FROM [zyk_Majors]" UpdateCommand="UPDATE [zyk_Majors] SET [Major_Name] = @Major_Name WHERE [Major_ID] = @Major_ID">
        <DeleteParameters>
            <asp:Parameter Name="Major_ID" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Major_Name" Type="String" />
            <asp:Parameter Name="Major_ID" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Major_ID" Type="String" />
            <asp:Parameter Name="Major_Name" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Jxzy_Database %>"></asp:SqlDataSource>
    各专业的文件子目录以专业代码形式命名，专业代码为国家统一编码。
</asp:Content>

